function tag() {
    var win = new Window({
        className: "dialog",
        width:300,
        height:350,
        zIndex: 100,
        resizable: true,
        title: "TagsTY window",
        showEffect:Effect.BlindDown,
        hideEffect: Effect.SwitchOff,
        draggable:true,
        wiredDrag: true
    })
    win.setContent("tabs");
    win.setStatusBar("");
    win.showCenter();
}
            
function tagCloud(){
    var url = "tagsty/tag_cloud.php";
    var ajax = new Ajax.Request( url, {
        //		parameters: pars,
        method:"get",
        onComplete: processAnswer
    }
    );
}
function processAnswer( answ ){
    $("tags_cloud").innerHTML = answ.responseText;
}
            
function tagCloudLink(urll){
    var url = urll;
    var ajax = new Ajax.Request( url, {
        method:"get",
        onComplete: processAnswer2
    }
    );
}
function processAnswer2( answ ){
    var numTabs=3;
    $("tabContent"+numTabs).innerHTML = answ.responseText;
}
      			
function comboOntologyLoad(){
    var url = "tagsty/ontology.php";
    var ajax = new Ajax.Request( url, {
        //		parameters: pars,
        method:"get",
        onComplete: processAnswer3
    }
    );
}
function processAnswer3( answ ){
    $("comboOntology").innerHTML = answ.responseText;
}  
/*-----------------------------------------------------------
                Toggles tabs - Closes any open tabs, and then opens current tab
                Input:     1.The number of the current tab
                                2.The number of tabs
                                3.(optional)The number of the tab to leave open
                                4.(optional)Pass in true or false whether or not to animate the open/close of the tabs
                Output: none 
                ---------------------------------------------------------*/
function toggleTab(num,numelems,opennum,animate) {
    if ($('tabContent'+num).style.display == 'none'){
        for (var i=1;i<=numelems;i++){
            if ((opennum == null) || (opennum != i)){
                var temph = 'tabHeader'+i;
                var h = $(temph);
                if (!h){
                    var h = $('tabHeaderActive');
                    h.id = temph;
                }
                var tempc = 'tabContent'+i;
                var c = $(tempc);
                if(c.style.display != 'none'){
                    if (animate || typeof animate == 'undefined')
                        Effect.toggle(tempc,'blind',{
                            duration:0.5,
                            queue:{
                                scope:'menus',
                                limit: 3
                            }
                            });
                    else
                        toggleDisp(tempc);
                }
            }
        }
        var h = $('tabHeader'+num);
        if (h)
            h.id = 'tabHeaderActive';
        h.blur();
        var c = $('tabContent'+num);
        c.style.marginTop = '2px';
        if (animate || typeof animate == 'undefined'){
            Effect.toggle('tabContent'+num,'blind',{
                duration:0.5,
                queue:{
                    scope:'menus',
                    position:'end',
                    limit: 3
                }
                });
        }else{
            toggleDisp('tabContent'+num);
        }
    }
}
            
function addNewTab(name,urll){
    var numTabs=3;
    var td=document.getElementById('tabHeader3');
    if ( td.hasChildNodes() )
    {
        while ( td.childNodes.length >= 1 )
        {
            td.removeChild( td.firstChild );
        }
    }
    var a = document.createElement("A");
    a.setAttribute("id","link"+numTabs);
    a.setAttribute("href","javascript:void(0);");
    a.setAttribute("onClick","toggleTab(3,3)");
    var span = document.createElement("SPAN");
    var texto = document.createTextNode(""+name);
    span.appendChild(texto);
    a.appendChild(span);
    td.appendChild(a);
    var div= document.getElementById('tabContent3');
    if ( div.hasChildNodes() )
    {
        while ( div.childNodes.length >= 1 )
        {
            div.removeChild( div.firstChild );
        }
    }
    var br = document.createElement("BR");
    div.setAttribute("class","tabContent");
    div.setAttribute("style","display:none");
    div.appendChild(br);
    tagCloudLink(urll);
    toggleTab(3,3);
}
